StepperULN2003
Loading...
Searching...
No Matches
Stepper Class Reference

Controls a 28BYJ-48 stepper motor via ULN2003 driver IC. More...

#include <StepperULN2003.h>

Public Types

enum  StepMode { HALF4 = 4 , FULL8 = 8 }
 Step resolution modes supported by the driver. More...
 

Public Member Functions

 Stepper (int steps, int in1, int in2, int in3, int in4)
 Constructor for the Stepper class.
 
void setSpeed (unsigned long speed)
 Set the motor speed in revolutions per minute (RPM).
 
void setStepMode (StepMode mode)
 Set the stepping mode (half-step or full-step).
 
void step (int steps)
 Move the motor a specified number of steps.
 

Detailed Description

Controls a 28BYJ-48 stepper motor via ULN2003 driver IC.

This class provides an interface to control a unipolar stepper motor using the ULN2003 driver in either half-step (4) or full-step (8) mode. Step timing is managed internally based on the set speed.

Member Enumeration Documentation

◆ StepMode

Step resolution modes supported by the driver.

Enumerator
HALF4 

Half-step mode (4 steps per cycle)

FULL8 

Full-step mode (8 steps per cycle)

Constructor & Destructor Documentation

◆ Stepper()

Stepper::Stepper ( int steps,
int in1,
int in2,
int in3,
int in4 )

Constructor for the Stepper class.

Parameters
stepsNumber of steps required for a full rotation (e.g., 4096).
in1Pin connected to IN1 of ULN2003.
in2Pin connected to IN2 of ULN2003.
in3Pin connected to IN3 of ULN2003.
in4Pin connected to IN4 of ULN2003.

Member Function Documentation

◆ setSpeed()

void Stepper::setSpeed ( unsigned long speed)

Set the motor speed in revolutions per minute (RPM).

Parameters
speedDesired speed in RPM (positive values only).

◆ setStepMode()

void Stepper::setStepMode ( StepMode mode)

Set the stepping mode (half-step or full-step).

Parameters
modeStepMode::HALF4 or StepMode::FULL8.

◆ step()

void Stepper::step ( int steps)

Move the motor a specified number of steps.

Parameters
stepsNumber of steps to move. Positive = clockwise, negative = counterclockwise.

The documentation for this class was generated from the following files: